define(['jquery', 'bootstrap', 'select2', 'validate', 'validate.en', 'shiftform'],
function($, validate) {
  return {
    
    init: function() {
      this.initCheckBox();
      this.dispose();
    },
    
    initCheckBox: function(){
        
      $(document).on("click", ".dispose-box input[type='checkbox']", function(e){
        
         $box = $(e.currentTarget);
          
         if($box.is(':checked')){
             $("input[name='financeIds']").prop("checked", true);
         } else {
             $("input[name='financeIds']").prop("checked", false);
         }
  
      })
        
    },
    
    dispose: function() {
      
      $("form").shiftform({
        beforeSubmit: function() {
          
          var selectOne = false;
          $('input[name="financeIds"]:checked').each(function(){
            selectOne = true;
            return false;
          });
          
          return selectOne;
          
        }
      });
      
    }
    
  }
})

